package com.cskaoyan.controller.wx_order;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.PageDataVo;
import com.cskaoyan.bean.wx_order.CancelOrderRespVO;
import com.cskaoyan.bean.wx_order.WXDetailOrderVO;
import com.cskaoyan.bean.wx_order.WXListOrderVO;
import com.cskaoyan.bean.wx_order.WXOrderCommentBO;
import com.cskaoyan.service.mall.OrderService;
import com.cskaoyan.service.wx_order.WXOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("wx/order")
public class WXOrderController {
    @Autowired
    WXOrderService wxOrderService;
//    @RequestMapping("list")
//    public BaseRespVo listOrders(Integer showType, Integer page, Integer limit ) {
//        WXListOrderVO wxListOrderVO = wxOrderService.listOrders(showType,page,limit);
//        return BaseRespVo.ok(wxListOrderVO);
//    }
    @RequestMapping("detail")
    public BaseRespVo orderDetail(Integer orderId){
      WXDetailOrderVO wxDetailOrderVO = wxOrderService.selectOrderById(orderId);
        return BaseRespVo.ok(wxDetailOrderVO);
    }
    @RequestMapping("cancel")
    public CancelOrderRespVO cancelOrder(@RequestBody Map<String,Integer> id){
        Integer orderId = id.get("orderId");
        wxOrderService.cancelOrder(orderId);
        return CancelOrderRespVO.ok();
    }
    @RequestMapping("comment")
    public BaseRespVo comment(@RequestBody WXOrderCommentBO wxOrderCommentBO){
        wxOrderService.sendComment(wxOrderCommentBO);
        return BaseRespVo.ok();
    }
}
